package com.example.mahoutdemo.controller;

import com.example.mahoutdemo.core.user.video.operation.UserVideoOperationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.mahout.cf.taste.common.TasteException;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("user-video-operation")
@Validated
@Slf4j
@Api(tags="用户电影")
public class UserVideoOperationController {

    private final UserVideoOperationService service;

    public UserVideoOperationController(UserVideoOperationService service) {
        this.service = service;
    }

    /**
     * 根据用户喜好推送视频
     * @return
     */
    @ApiOperation("根据用户喜好推送")
    @GetMapping("/recommendations/{customerId}")
    public List<Long> recommend(@PathVariable Long customerId) throws TasteException {
        return service.recommend(customerId);
    }
}
